//
//  IManager+ModuleMerchantPictureAlbum.m
//  RocketProject
//
//  Created by Wu Chengwei on 13-9-29.
//  Copyright (c) 2013年 Rocket. All rights reserved.
//

#import "IManager+ModuleMerchantPictureAlbum.h"
#import "FrameworkRelativeDefines.h"
#import "NetUrlDefines.h"
#import "RequestUtlity.h"
#import "NSString+NSString_Ex_.h"
#import "TravelException.h"
#import "GloableEngineService.h"
#import "RCMerchantPicturesDataModel.h"

@implementation IManager(ModuleMerchantPictureAlbum)

-(int64_t)requestMerchantPictureAlbumInfo:(NSString *)merchantID withPn:(NSInteger)pn withRn:(NSInteger)rn withDelegate:(id<IManagerDelegate>)delegate{
    if ([NSString stringIsNullOrEmpty:merchantID]) {
        return kInvalidRequestId;
    }
    NSString *urlSuffix = [NSString stringWithFormat:kRCMerchantPictureAlbumPrefix,merchantID,pn,rn];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[RCMerchantPicturesDataModel class]
                                                     withDataDelegate:delegate];
}


-(int64_t)requestMerchantPictureSubAlbunInfo:(NSString *)merchantID withTypeID:(NSString *)typeID withPn:(NSInteger)pn withRn:(NSInteger)rn withDelegate:(id<IManagerDelegate>)delegate{
    if ([NSString stringIsNullOrEmpty:merchantID] || [NSString stringIsNullOrEmpty:typeID]) {
        return kInvalidRequestId;
    }
    NSString *urlSuffix = [NSString stringWithFormat:kRCMerchantPictureSubAlbumPrefix,merchantID,typeID,pn,rn];
    
    NSString *url = [RequestUtlity getFormattedUrl:urlSuffix];
    
    KFLog(@"request url %@",url);
    return [[IDataProvider sharedInstance] asyncFetchDataWithUserInfo:url
                                                             userInfo:nil
                                                      withCachePolicy:IDataCachePolicyLocalFileAndNetwork
                                                   withDataParseClass:[rcMerchantPictureSubAlbum class]
                                                     withDataDelegate:delegate];
}

@end
